package com.frame.service;

import com.frame.bean.User;
import com.frame.dao.UserMapper;
import com.frame.util.MyBatisUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class UserService {
    public List<User> findUser(String name){
        SqlSession sqlSession = MyBatisUtil.openSqlSession();
        UserMapper userMapper = sqlSession.getMapper(UserMapper.class);
        List<User> users = userMapper.selectByName(name);
        if(sqlSession!=null)
            sqlSession.close();
        return users;
    }
}
